/*
 *
 * @ProjectName:    my_umi_app
 * @Package:
 * @ClassName:      useAdList
 * @Description:    TypeScript文件
 * @Author:         SuPeiSen
 * @CreateDate:     2021/3/5 2:34 下午
 * @UpdateDate:     2021/3/5 2:34 下午
 * @UpdateRemark:   更新说明：
 * @Version:        1.0
 */

import { useEffect, useState } from 'react';
import { BlogAdItemType } from '@/type/blog/ad_type';
import { BlogGetAdListApi } from '@/service/blog/blog_ad_api';

export const useAdList = () => {
  // 保存广告
  const [adList, setAdList] = useState<Array<BlogAdItemType>>([]);

  useEffect(() => {
    BlogGetAdListApi().then((model) => {
      if (model.success) {
        setAdList(model.data!.data);
      }
    });
  }, []);

  return [adList];
};
